package com.ajobs.project.testweb.controller;

import com.ajobs.project.testweb.entity.TbUser;
import com.ajobs.project.testweb.service.TbUserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 用户表(TbUser)表控制层
 *
 * @author makejava
 * @since 2022-03-25 23:32:06
 */
@RestController
@RequestMapping("/tbUser")
public class TbUserController {
    /**
     * 服务对象
     */
    @Resource
    private TbUserService tbUserService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("/{id}")
    public TbUser selectOne(@PathVariable Integer id) {
        return this.tbUserService.queryById(id);
    }

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("/updateAge/{id}/{age}")
    public TbUser updateAgeById(@PathVariable Integer id, @PathVariable Integer age) {
        return this.tbUserService.updateAgeById(id, age);
    }

}